import 'base_model.dart';

/// 推荐视频点赞模型
class VideoLike implements BaseModel {
  final int? id;
  final int userId; // 点赞用户ID
  final int videoId; // 视频ID
  final DateTime createdAt; // 创建时间
  final DateTime updatedAt; // 更新时间

  VideoLike({
    this.id,
    required this.userId,
    required this.videoId,
    required this.createdAt,
    required this.updatedAt,
  });

  @override
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'user_id': userId,
      'video_id': videoId,
      'created_at': createdAt.millisecondsSinceEpoch,
      'updated_at': updatedAt.millisecondsSinceEpoch,
    };
  }

  factory VideoLike.fromJson(Map<String, dynamic> json) {
    return VideoLike(
      id: json['id'],
      userId: json['user_id'],
      videoId: json['video_id'],
      createdAt: DateTime.fromMillisecondsSinceEpoch(json['created_at']),
      updatedAt: DateTime.fromMillisecondsSinceEpoch(json['updated_at']),
    );
  }
}

/// 推荐视频收藏模型
class VideoFavorite implements BaseModel {
  final int? id;
  final int userId; // 收藏用户ID
  final int videoId; // 视频ID
  final DateTime createdAt; // 创建时间
  final DateTime updatedAt; // 更新时间

  VideoFavorite({
    this.id,
    required this.userId,
    required this.videoId,
    required this.createdAt,
    required this.updatedAt,
  });

  @override
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'user_id': userId,
      'video_id': videoId,
      'created_at': createdAt.millisecondsSinceEpoch,
      'updated_at': updatedAt.millisecondsSinceEpoch,
    };
  }

  factory VideoFavorite.fromJson(Map<String, dynamic> json) {
    return VideoFavorite(
      id: json['id'],
      userId: json['user_id'],
      videoId: json['video_id'],
      createdAt: DateTime.fromMillisecondsSinceEpoch(json['created_at']),
      updatedAt: DateTime.fromMillisecondsSinceEpoch(json['updated_at']),
    );
  }
}
